home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00082_Script_SET BROWSER TOPICS
< prev
next >
Wrap
Text File
|
1996-03-28
|
6KB
|
199 lines
-- ---------------------------------------------------------------
-- Handler setDatabaseBrowserGlobals
on setDatabaseBrowserGlobals
setBrowserLineHeight
setNumVisibleTopics
setNumVisibleLines
setNumBrowsers
setCurrentBrowser(1)
initializeBrowserTopics
setNumberTopics
setNumbernumVisibleLines
setBrowserTopLine(1)
initializeMasterBrowserTopics
setTextLineHeight
end
-- ---------------------------------------------------------------
-- Handler setNumBrowsers sets the global variable
-- numBrowsers to the number of fields storing the browser
-- topics (since one is not always enough). It sets the variable,
-- depending on the current mode.
on setNumBrowsers
global numBrowsers, mode
if (mode = "index") then
set numBrowsers = 1
else if (mode = "media") then
set numBrowsers = 1
else if (mode = "search") then
set numBrowsers = 1
end if
end
-- ---------------------------------------------------------------
-- Handler setCurrentBrowser sets the global variable
-- currentBrowser to the name of the browserTopics field that
-- is currently being displayed in the onstage broswer.
on setCurrentBrowser whichNumber
global currentBrowser, numBrowsers
-- ERROR HANDLING
if (whichNumber > numBrowsers) then
set currentBrowser = 1
else -- update normally
set currentBrowser = whichNumber
end if
end
-- ---------------------------------------------------------------
-- Handler initializeBrowserTopics initializes the global variable
-- browserTopics to the first subset of topics.
on initializeBrowserTopics
global browserTopics
set browserTopics = the text of cast "browserTopics"
end
-- ---------------------------------------------------------------
-- Handler setBrowserTopics sets the global variable
-- browserTopics to the given list of topics.
on setBrowserTopics whichTopics
global browserTopics
set browserTopics = whichTopics
end
-- ---------------------------------------------------------------
-- Handler setNumberTopics sets the global variable numberTopics
-- to the number of browser topics in the database by adding
-- together the number of topics in each of the browserTopics
-- fields.
on setNumberTopics
global numberTopics, numBrowsers, browserTopics
-- browserTopics has a blank line at the end so subtract
-- 1 to get the number of topics
set numberTopics = (the number of lines in browserTopics - 1)
end
-- ---------------------------------------------------------------
-- Handler setNumbernumVisibleLines sets the global variable
-- numnumVisibleLines to the number of lines in all the browser
-- fields.
on setNumbernumVisibleLines
global numnumVisibleLines, browserTopics
-- browserTopics has a blank line at the end so subtract
-- 1 to get the number of topics
set numnumVisibleLines = numnumVisibleLines + the number of lines in browserTopics - 1
end
-- ---------------------------------------------------------------
-- Handler initializeMasterBrowserTopics initializes the global
-- variable masterBrowserTopics to the global variable browserTopics.
-- The variable masterBrowserTopics contains the current list of
-- topics that appear in the browser and can be a subset of either
-- all browser topics or of the search results.
on initializeMasterBrowserTopics
global masterBrowserTopics, browserTopics
set masterBrowserTopics = browserTopics
end
-- ---------------------------------------------------------------
-- Handler setMasterBrowserTopics sets the global
-- variable masterBrowserTopics to the given list of topics.
on setMasterBrowserTopics whichTopics
global masterBrowserTopics
set masterBrowserTopics = whichTopics
end
-- ---------------------------------------------------------------
-- Handler setNumVisibleTopics sets the global variable
-- numVisibleTopis to the number of topics that can appear in the
-- browser
on setNumVisibleTopics
global numVisibleTopics, browser, browserLineHeight
-- one less to always keep an empty line at the end
set numVisibleTopics = integer (((the height of sprite browser + (browserLineHeight - 1 ))/ browserLineHeight) - 1)
end
-- ---------------------------------------------------------------
-- Handler setNumVisibleLines sets the global variable numVisibleLines
-- to the number of lines that can appear in the browser.
on setNumVisibleLines
global numVisibleLines, numVisibleTopics
-- numVisibleTopics*numLinesPerBrowserEntry+numVisibleTopics-1 is the number
-- of visible lines accounting for the empty line between entries
-- numVisibleLines = 19 in battlefield
set numVisibleLines = numVisibleTopics
end
-- ---------------------------------------------------------------
-- Handler setBrowserTopLine sets the global variable
-- browserTopLine to the given value
on setBrowserTopLine whichValue
global browserTopLine
set browserTopLine = whichValue
end
-- ---------------------------------------------------------------
-- Handler setBrowserText sets the text of the onstage browser
-- (field "browser").
on setBrowserText
global browserTopLine, numVisibleTopics, browserTopics
global numBrowsers, currentBrowser, browserTopics, numVisibleLines
set lastLine = numVisibleLines + browserTopLine - 1
set browserText = line browserTopLine to lastLine of browserTopics
set the text of cast "browser" = browserText
put EMPTY into line (lastLine + 1) of cast "browser"
end
-- ---------------------------------------------------------------
-- Handler setBrowserTopicsToCurrentBrowser sets the global
-- variable browserTopics to the current browserField
on setBrowserTopicsToCurrentBrowser
global currentBrowser, mode, browserTopics, mediaTopics
if (mode = "index") then
setBrowserTopics(browserTopics)
else if (mode = "media") then
setBrowserTopics(mediaTopics)
end if
end
-- ---------------------------------------------------------------
-- Handler setTopicProperty sets the global variable topicProperty
-- to the given property, (one of the properties of topics can
-- have in the database, eg. "text", "picture"...). This is used
-- for setting the more buttons.
on setTopicProperty whichProperty
global topicProperty
set topicProperty = whichProperty
end